<div class="tabbable tabs-left">
              <ul class="nav nav-tabs">
              	<li><h5><?php echo $this->translate('广告'); ?></h5></li>
                <li class="active"><a data-toggle="tab" href="#express_a"><?php echo $this->translate('基本信息'); ?></a></li>
              </ul>
              <form class="form-horizontal" name="ad_form" id="ad_form" method="post" enctype="multipart/form-data" action="">
              <input type="hidden" name="ad_id" id="ad_id" value="<?php if($this->ad_info) echo $this->ad_info->ad_id; else echo ''; ?>" />
              <div class="tab-content">
    			<div id="sticky_navigation" style="height:30px;border-bottom:4px solid #DFDFDF;">
        			<div class="pull-left" style="font-size:16px;line-height:30px;"><strong><?php if($this->ad_info) echo $this->translate('编辑'); else echo $this->translate('新加'); ?><?php echo $this->translate('电脑端广告'); ?></strong></div>
        			<div class="pull-right">
                	<a href="<?php echo $this->url('ad/default/ad-type', array('action'=>'setad', 'ad_type'=>$this->ad_type)); ?>" class="btn btn-small"><i class="icon-arrow-left"></i> <?php echo $this->translate('返回广告设置'); ?></a>&nbsp;
                	<a href="<?php echo $this->serverUrl(true); ?>" class="btn btn-small btn-warning"><i class="icon-repeat icon-white"></i> <?php echo $this->translate('刷新'); ?></a>&nbsp;
                    <?php if($this->ad_info) { ?>
                    <a href="javascript:;" onclick="return ad_del_js(<?php echo $this->ad_info->ad_id ?>);" class="btn btn-small btn-danger"><i class="icon-remove icon-white"></i> <?php echo $this->translate('删除广告'); ?></a>&nbsp;
                    <?php } ?>
                	<button type="submit" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存广告信息'); ?></button>&nbsp;
                	<a href="<?php echo $this->myviewalias()->dbshopHelpUrl('ad_set'); ?>" target="_blank" class="btn btn-small btn-info"><i class="icon-info-sign icon-white"></i> <?php echo $this->translate('查看帮助说明'); ?></a>
                	</div>
        		</div>
                <div id="express_a" class="tab-pane active">
                	<div class="well admin_add_header_well"><?php echo $this->translate('基本信息'); ?></div>
                	<div class="well admin_add_well"> 
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('广告类别'); ?>：</label>
           					<div class="controls">
              					<label><?php echo $this->set_ad_class_name; ?></label>
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('广告位置'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<select name="ad_place" id="ad_place" class="span2" <?php echo (isset($this->ad_info->ad_place) and !empty($this->ad_info->ad_place)) ? 'disabled' : ''; ?> onchange="show_image_size();">
                                	<option value=""><?php echo $this->translate('请选择'); ?></option>
                                	<?php if(is_array($this->ad_place) and !empty($this->ad_place)) foreach ($this->ad_place as $place_key => $place_value) { ?>
                                	<option value="<?php echo $place_key; ?>" <?php if($this->ad_info and $this->ad_info->ad_place == $place_key) echo 'selected="selected"'; ?>><?php echo $place_value; ?></option>
                                    <?php } ?>
                                </select>
                            <?php if(isset($this->ad_info->ad_place) and !empty($this->ad_info->ad_place)) { ?>
                                <input type="hidden" name="ad_place" id="ad_place" value="<?php echo $this->ad_info->ad_place; ?>">
                            <?php } ?>
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('广告名称'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<input type="text" id="ad_name"  name="ad_name" class="span8" value="<?php echo ($this->ad_info ? $this->escapeHtml($this->ad_info->ad_name) : ''); ?>">
            				</div>                        
                        </div>
						<?php if(in_array($this->ad_type, array('goodsclass', 'goods'))) { ?>
							<?php if(isset($this->ad_info->goods_class_id) and !empty($this->ad_info->goods_class_id)) { $goods_class_id_array = explode(',', $this->ad_info->goods_class_id); } ?>
							<div class="control-group">
								<label for="input01" class="control-label"><?php echo $this->translate('对应商品分类'); ?>：</label>
								<div class="controls">
									<b><?php echo $this->translate('无 已选分类 视为默认全部分类'); ?></b>
									<select multiple="multiple" id="my-select" name="goods_class_id[]">
										<?php if($this->goods_class) foreach ($this->goods_class as $class_value) { ?>
											<option value='<?php echo $class_value['class_id']; ?>' <?php if(isset($goods_class_id_array) and !empty($goods_class_id_array) and in_array($class_value['class_id'], $goods_class_id_array)) echo 'selected'; ?>><?php echo str_repeat('&nbsp;', $class_value['class_level'] * 3).$this->escapeHtml($class_value['class_name']); ?></option>
										<?php } ?>
									</select>
								</div>
							</div>
						<?php } ?>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('开始时间'); ?>：</label>
           					<div class="controls">
              					<input type="text" name="ad_start_time" id="ad_start_time" value="<?php if ($this->ad_info and $this->ad_info->ad_start_time != '') echo date("Y-m-d H:i",$this->ad_info->ad_start_time); ?>" onclick="WdatePicker({el:'ad_start_time', dateFmt:'yyyy-MM-dd HH:mm'})" class="span2 Wdate" />
                                <i class="cus-help shop_admin_help_note" data-content="<?php echo sprintf($this->translate('%s开始时间%s：当开始时间为空时为不限制，如填写时间，开始时间必须小于结束时间。'),'<strong>','</strong>'); ?>"></i>
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('结束时间'); ?>：</label>
           					<div class="controls">
              					<input type="text" name="ad_end_time" id="ad_end_time" value="<?php if ($this->ad_info and $this->ad_info->ad_end_time != '') echo date("Y-m-d H:i",$this->ad_info->ad_end_time); ?>" onclick="WdatePicker({el:'ad_end_time', dateFmt:'yyyy-MM-dd HH:mm'})" class="span2 Wdate" />
                                <i class="cus-help shop_admin_help_note" data-content="<?php echo sprintf($this->translate('%s结束时间%s：当结束时间为空时为不限制，如填写时间，结束时间必须大于开始时间。'),'<strong>','</strong>'); ?>"></i>
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('广告类型'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
                            	<select name="ad_type" id="ad_type" class="span2" onchange="change_ad_type();">
                                	<option value=""><?php echo $this->translate('请选择广告类型'); ?></option>
                                	<option value="image" <?php if($this->ad_info and $this->ad_info->ad_type == 'image') echo 'selected="selected"'; ?>><?php echo $this->translate('图片'); ?></option>
                                    <option value="text" <?php if($this->ad_info and $this->ad_info->ad_type == 'text') echo 'selected="selected"'; ?>><?php echo $this->translate('文字'); ?></option>
                                    <option value="code" <?php if($this->ad_info and $this->ad_info->ad_type == 'code') echo 'selected="selected"'; ?>><?php echo $this->translate('代码'); ?></option>
                                    <option value="slide" <?php if($this->ad_info and $this->ad_info->ad_type == 'slide') echo 'selected="selected"'; ?>><?php echo $this->translate('幻灯片'); ?></option>
                                </select>
                                &nbsp;&nbsp;<span id="recom_image_size"></span>
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_image" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('广告图片'); ?>：</label>
           					<div class="controls">
                            	<?php if($this->ad_info and !empty($this->ad_info->ad_body)) { ?>
                                <img src="<?php echo $this->basePath($this->ad_info->ad_body); ?>" border="0" style="max-width:500px;" />
                                <input type="hidden" name="old_ad_image" value="<?php echo $this->ad_info->ad_body; ?>" />
                                <br />
                                <?php } ?>
                            	<input type="file" name="ad_image" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_text" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('广告文字'); ?>：</label>
           					<div class="controls">
                            	<script type="text/plain" id="ad_text" name="ad_text"><?php if($this->ad_info and $this->ad_info->ad_type == 'text') echo $this->ad_info->ad_body; ?></script>
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_code" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('广告代码'); ?>：</label>
           					<div class="controls">
                            	<textarea class="span6" name="ad_code" id="ad_code" rows="3"><?php if($this->ad_info and $this->ad_info->ad_type == 'code') echo $this->ad_info->ad_body; ?></textarea>
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('幻灯片图片1'); ?>：</label>
           					<div class="controls">
                                <?php $slide_content_0 = false; if($this->slide_array and !empty($this->slide_array[0])) { $slide_content_0 = true;
									$file1_md5_str = md5($this->slide_array[0]['ad_slide_image']);
									?>
                                <img class="<?php echo $file1_md5_str; ?>" src="<?php echo $this->basePath($this->slide_array[0]['ad_slide_image']); ?>" border="0" style="max-width:500px;" />
								<a href="javascript:;" class="badge badge-important <?php echo$file1_md5_str; ?>" onclick="del_slide_image(<?php echo $this->ad_info->ad_id; ?>, '<?php echo $this->slide_array[0]['ad_slide_image']; ?>');" title="<?php echo $this->translate('删除图片'); ?>">X</a>
                                <input class="<?php echo $file1_md5_str; ?>" type="hidden" name="old_ad_slide_image_1" value="<?php echo $this->slide_array[0]['ad_slide_image']; ?>" />
                                <br class="<?php echo $file1_md5_str; ?>" />
                                <?php } ?>
                            	<input type="file" name="ad_slide_image_1" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('显示文字1'); ?>：</label>
           					<div class="controls">
                            	<textarea class="span6" name="ad_slide_text_1" rows="2"><?php if($slide_content_0) echo $this->slide_array[0]['ad_slide_info']; ?></textarea>
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('链接地址1'); ?>：</label>
           					<div class="controls">
                            	<input type="text"  name="ad_slide_url_1" class="span8" value="<?php if($slide_content_0) echo $this->slide_array[0]['ad_slide_url']; ?>">
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('排序1'); ?>：</label>
           					<div class="controls">
                            	<input type="text" name="ad_slide_sort_1" value="<?php echo ($slide_content_0 ? $this->slide_array[0]['ad_slide_sort'] : 1); ?>" class="span1" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('幻灯片图片2'); ?>：</label>
           					<div class="controls">
                                <?php $slide_content_1 = false; if($this->slide_array and !empty($this->slide_array[1])) { $slide_content_1 = true;
									$file2_md5_str = md5($this->slide_array[1]['ad_slide_image']);
									?>
                                <img class="<?php echo $file2_md5_str; ?>" src="<?php echo $this->basePath($this->slide_array[1]['ad_slide_image']); ?>" border="0" style="max-width:500px;" />
								<a href="javascript:;" class="badge badge-important <?php echo $file2_md5_str; ?>" onclick="del_slide_image(<?php echo $this->ad_info->ad_id; ?>, '<?php echo $this->slide_array[1]['ad_slide_image']; ?>');" title="<?php echo $this->translate('删除图片'); ?>">X</a>
								<input class="<?php echo $file2_md5_str; ?>" type="hidden" name="old_ad_slide_image_2" value="<?php echo $this->slide_array[1]['ad_slide_image']; ?>" />
                                <br class="<?php echo $file2_md5_str; ?>" />
                                <?php } ?>
                            	<input type="file" name="ad_slide_image_2" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('显示文字2'); ?>：</label>
           					<div class="controls">
                            	<textarea class="span6" name="ad_slide_text_2" rows="2"><?php if($slide_content_1) echo $this->slide_array[1]['ad_slide_info']; ?></textarea>
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('链接地址2'); ?>：</label>
           					<div class="controls">
                            	<input type="text"  name="ad_slide_url_2" class="span8" value="<?php if($slide_content_1) echo $this->slide_array[1]['ad_slide_url']; ?>">
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('排序2'); ?>：</label>
           					<div class="controls">
                            	<input type="text" name="ad_slide_sort_2" value="<?php echo ($slide_content_1 ? $this->slide_array[1]['ad_slide_sort'] : 2); ?>" class="span1" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('幻灯片图片3'); ?>：</label>
           					<div class="controls">
                                <?php $slide_content_2 = false; if($this->slide_array and !empty($this->slide_array[2])) { $slide_content_2 = true;
									$file3_md5_str = md5($this->slide_array[2]['ad_slide_image']);
									?>
                                <img class="<?php echo $file3_md5_str; ?>" src="<?php echo $this->basePath($this->slide_array[2]['ad_slide_image']); ?>" border="0" style="max-width:500px;" />
								<a href="javascript:;" class="badge badge-important <?php echo $file3_md5_str; ?>" onclick="del_slide_image(<?php echo $this->ad_info->ad_id; ?>, '<?php echo $this->slide_array[2]['ad_slide_image']; ?>');" title="<?php echo $this->translate('删除图片'); ?>">X</a>
								<input class="<?php echo $file3_md5_str; ?>" type="hidden" name="old_ad_slide_image_3" value="<?php echo $this->slide_array[2]['ad_slide_image']; ?>" />
                                <br class="<?php echo $file3_md5_str; ?>" />
                                <?php } ?>
                            	<input type="file" name="ad_slide_image_3" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('显示文字3'); ?>：</label>
           					<div class="controls">
                            	<textarea class="span6" name="ad_slide_text_3" rows="2"><?php if($slide_content_2) echo $this->slide_array[2]['ad_slide_info']; ?></textarea>
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('链接地址3'); ?>：</label>
           					<div class="controls">
                            	<input type="text"  name="ad_slide_url_3" class="span8" value="<?php if($slide_content_2) echo $this->slide_array[2]['ad_slide_url']; ?>">
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('排序3'); ?>：</label>
           					<div class="controls">
                            	<input type="text" name="ad_slide_sort_3" value="<?php echo ($slide_content_2 ? $this->slide_array[2]['ad_slide_sort'] : 3); ?>" class="span1" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('幻灯片图片4'); ?>：</label>
           					<div class="controls">
                                <?php $slide_content_3 = false; if($this->slide_array and !empty($this->slide_array[3])) { $slide_content_3 = true;
									$file4_md5_str = md5($this->slide_array[3]['ad_slide_image']);
									?>
                                <img class="<?php echo $file4_md5_str; ?>" src="<?php echo $this->basePath($this->slide_array[3]['ad_slide_image']); ?>" border="0" style="max-width:500px;" />
									<a href="javascript:;" class="badge badge-important <?php echo $file4_md5_str; ?>" onclick="del_slide_image(<?php echo $this->ad_info->ad_id; ?>, '<?php echo $this->slide_array[3]['ad_slide_image']; ?>');" title="<?php echo $this->translate('删除图片'); ?>">X</a>
								<input class="<?php echo $file4_md5_str; ?>" type="hidden" name="old_ad_slide_image_4" value="<?php echo $this->slide_array[3]['ad_slide_image']; ?>" />
                                <br class="<?php echo $file4_md5_str; ?>" />
                                <?php } ?>
                            	<input type="file" name="ad_slide_image_4" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('显示文字4'); ?>：</label>
           					<div class="controls">
                            	<textarea class="span6" name="ad_slide_text_4" rows="2"><?php if($slide_content_3) echo $this->slide_array[3]['ad_slide_info']; ?></textarea>
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('链接地址4'); ?>：</label>
           					<div class="controls">
                            	<input type="text"  name="ad_slide_url_4" class="span8" value="<?php if($slide_content_3) echo $this->slide_array[3]['ad_slide_url']; ?>">
            				</div>                        
                        </div> 
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('排序4'); ?>：</label>
           					<div class="controls">
                            	<input type="text" name="ad_slide_sort_4" value="<?php echo ($slide_content_3 ? $this->slide_array[3]['ad_slide_sort'] : 4); ?>" class="span1" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('幻灯片图片5'); ?>：</label>
           					<div class="controls">
                                <?php $slide_content_4 = false; if($this->slide_array and !empty($this->slide_array[4])) { $slide_content_4 = true;
									$file5_md5_str = md5($this->slide_array[4]['ad_slide_image']);
									?>
                                <img class="<?php echo $file5_md5_str; ?>" src="<?php echo $this->basePath($this->slide_array[4]['ad_slide_image']); ?>" border="0" style="max-width:500px;" />
								<a href="javascript:;" class="badge badge-important <?php echo $file5_md5_str; ?>" onclick="del_slide_image(<?php echo $this->ad_info->ad_id; ?>, '<?php echo $this->slide_array[4]['ad_slide_image']; ?>');" title="<?php echo $this->translate('删除图片'); ?>">X</a>
								<input class="<?php echo $file5_md5_str; ?>" type="hidden" name="old_ad_slide_image_5" value="<?php echo $this->slide_array[4]['ad_slide_image']; ?>" />
                                <br class="<?php echo $file5_md5_str; ?>" />
                                <?php } ?> 
                            	<input type="file" name="ad_slide_image_5" />
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('显示文字5'); ?>：</label>
           					<div class="controls">
                            	<textarea class="span6" name="ad_slide_text_5" rows="2"><?php if($slide_content_4) echo $this->slide_array[4]['ad_slide_info']; ?></textarea>
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('链接地址5'); ?>：</label>
           					<div class="controls">
                            	<input type="text"  name="ad_slide_url_5" class="span8" value="<?php if($slide_content_4) echo $this->slide_array[4]['ad_slide_url']; ?>">
            				</div>                        
                        </div>
                    	<div class="control-group ad_type_class ad_slide" style="display:none">
                  			<label for="input01" class="control-label"><?php echo $this->translate('排序5'); ?>：</label>
           					<div class="controls">
                            	<input type="text" name="ad_slide_sort_5" value="<?php echo ($slide_content_4 ? $this->slide_array[4]['ad_slide_sort'] : 5); ?>" class="span1" />
            				</div>                        
                        </div> 
                    	<div class="control-group ad_url">
                  			<label for="input01" class="control-label"><?php echo $this->translate('广告URL地址'); ?>：</label>
           					<div class="controls">
              					<input type="text" id="ad_url"  name="ad_url" class="span8" value="<?php echo ($this->ad_info ? $this->escapeHtml($this->ad_info->ad_url) : ''); ?>">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('状态'); ?>：</label>
           					<div class="controls">
              					<label class="radio inline"><input type="radio" value="1" <?php if(($this->ad_info and $this->ad_info->ad_state == 1) or !$this->ad_info) echo 'checked="checked"'; ?> name="ad_state"><?php echo $this->translate('启用'); ?></label>
                                <label class="radio inline"><input type="radio" value="2" <?php if($this->ad_info and $this->ad_info->ad_state == 2) echo 'checked="checked"'; ?> name="ad_state"><?php echo $this->translate('禁用'); ?></label> 
            				</div>                        
                        </div>                                                                                                                                               
                  	</div>
                </div>
                                
                
             </div>
              </form>
</div>
<?php echo $this->partial('common/editor',array('edit_array'=>array('ad_text'),
'edit_config'=>array(
"toolbars:[['FullScreen', 'Source', 'Undo', 'Redo','Bold']]",
"wordCount:false",
"initialFrameHeight:100",
"elementPathEnabled:false",
"maximumWords:500"
)));
 ?>
<script src="<?php echo $this->basePath('/public/js/DatePicker/WdatePicker.js'); ?>"></script>
<script>
//客户分组保存验证
$(document).ready(function() {
	$("#ad_form").validate({
		rules: {
			ad_place: {
				required: true
			},
			ad_name: {
				required: true,
				maxlength:30
			},
			ad_type: {
				required: true
			}
		},
		messages: {
			ad_place: {
				required: "<?php echo $this->translate('广告位置不能为空！'); ?>"
			},
			ad_name: {
				required: "<?php echo $this->translate('广告名称不能为空！'); ?>",
				maxlength: "<?php echo $this->translate('广告名称最多输入80个汉字！'); ?>"
			},
			ad_type: {
				required: "<?php echo $this->translate('广告类型不能为空！'); ?>"
			}
		}
	});
});
//切换广告类型
function change_ad_type() {
	var ad_type = $('#ad_type').val();
	$('.ad_type_class').css('display', 'none');
	if(ad_type != '') {
		$('.ad_'+ad_type).css('display', '');
		if(ad_type == 'slide') $('.ad_url').css('display', 'none'); else $('.ad_url').css('display', '');
		
		//调用推荐尺寸
		show_image_size();
	}
}
<?php if ($this->ad_info) { ?>
change_ad_type();
<?php } ?>
//显示广告图片及幻灯片推荐尺寸
function show_image_size() {
	var ad_type_val  = $('#ad_type').val();
	var ad_place_val = $('#ad_place').val();
	var type_val     = '<?php echo (isset($this->ad_type) ? $this->ad_type : ''); ?>';
 $.post("<?php echo $this->url('ad/default',array('action'=>'getImageSize')); ?>",{ad_type:ad_type_val,ad_place:ad_place_val,type:type_val},
	function(data){
		$('#recom_image_size').html(data);
	});
}
//广告删除js
function ad_del_js(ad_id) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该广告吗？'); ?>')) {
	$.post("<?php echo $this->url('ad/default/ad-type',array('action'=>'delad','ad_type'=>$this->ad_type)); ?>",{ad_id:ad_id},
	function(data){
		if(data != 'false') {
			window.location.href='<?php echo $this->url('ad/default/ad-type',array('action'=>'setad','ad_type'=>$this->ad_type)); ?>';
			return true;
		} else {
			alert('<?php echo $this->translate('广告删除失败！'); ?>');
		}
	});
	}
	return false;
}

function del_slide_image(ad_id, image_path) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该图片吗？'); ?>')) {
		$.post("<?php echo $this->url('ad/default',array('action'=>'delSlideImage')); ?>",{ad_id:ad_id,image_path:image_path},
				function(data){
					if(data != 'false') {
						$('.'+data).remove();
						return true;
					} else {
						alert('<?php echo $this->translate('图片删除失败！'); ?>');
					}
				});
	}
	return false;
}
</script>
<?php if(in_array($this->ad_type, array('goodsclass', 'goods'))) { ?>
<link href="<?php echo $this->basePath('/public/js/multi/css/multi-select.css'); ?>" rel="stylesheet">
<script src="<?php echo $this->basePath('/public/js/multi/jquery.multi-select.js'); ?>"></script>
<script>
	//配送地区选择
	$('#my-select').multiSelect({
		selectableHeader: "<div class='custom-header'><?php echo $this->translate('待选分类'); ?></div>",
		selectionHeader: "<div class='custom-header'><?php echo $this->translate('已选分类'); ?></div>"
	});
</script>
<?php } ?>